I'm importing a word document into doors that has the version number (in text format) above the requirement object. Both are imported as separate objects. I need a way to move the version number into a text based attribute of its partner requirement. |
Re: Copy heading to attribute
Word Imports support the notion of a hierarchy spec, but you can only import from Word into Object Heading or Text. Excel Imports support the notion of an attributed spread sheet, you can import into multiple attributes, but you cannot define the Hierarchy of your module in this way. Pick your poison.
Regexp reVersion1 = regexp2("^(versFormat1)(\\n)(.*)$") // one possible format of Version,
reVersion2 = regexp2("^(versFormat2)(\\n)(.*)$") // next possible format
string NameAttrVersion = "VersionImport"
bool UpdateVersion(Object obj)
{ // if the object Text contains a Version string in its first line and the Version attribute does not,
// then remove the Version from the Text and update the Version Attribute.
// Object text must not contain rich text nor OLE (actually, rich text and OLE is removed when
// version is updated)
// Return whether the objects was updated or not
if (null obj) return(false)
if (!null probeAttr_(obj, NameAttrVersion) return(false)
string Text = probeAttr_(obj, "Object Text")
if (reVersion1 Text or
reVersion2 Text)
{ // Version String Found
obj.NameAttrVersion = Text[match 1]
obj."Object Text" = Text[match 3]
return(true)
}
else
{ return(false)
}
} // end UpdateVersion()
|
Re: Copy heading to attribute You need to move (cut-n-paste) the Version Number text into the same paragraph as the associated requirement text. Place it at the very beginning of the para but include a delimiter character of some sort so that it separates the Version Number text from the Requirements text. Ideally, use a unique character as the delimiter, something that is not used in the document. For example - two para's: Version XYZ The system shall blah blah blah. Becomes a single para with a # delimiter: Version XYZ#The system shall blah blah blah. If the syntax of your version text is predictable, you can take advantage of MSWords find&Replace feature in conjunction with regular expressions to avoid doing it manually. VBA scripting would also be useful if it requires a more sophisticated approach. Export the Word document to DOORS. Create a DXL script that can chomp out the Version Text up to and including the delimiter and copy it to a specified string attribute of your choice (have attached an example) - the script looks for the delimiter in the Object Text attribute of each Object and if found, copy the preceding characters into a buffer, remove the characters and the delimiter from the Object Text, copy the contents of the buffer to a specified attribute of the current object. If you know that the version text cannot be any longer than a certain number of characters, then only search that far into the Object Text for the delimiter. If your requirements have rich text formatting such as bold, italics etc, you'll need to use DXL RTF library functions to execute the chomp so that no RTF is lost. I've attached a DXL script I have used in the past to do something like this, it assumes no RTF has been used, might give you some ideas or you can modify to suit. Paul Miller Melbourne, Australia Attachments attachment_14583860__ExtractAndReplaceString.dxl |
Re: Copy heading to attribute SystemAdmin - Wed Feb 16 17:32:25 EST 2011 Paul Miller Melbourne, Australia if word document use styles for each part of the requirements (identifier, version, texte, etc.), it is very efficient do post processing using 'paragraph style' attribut. Pierre |
Re: Copy heading to attribute Version number Requriement Then I would like the version number to become an attribute of the requirement. I'm trying to use the "nextObj" code to do this, but I'm not making much progress. Any ideas? |
Re: Copy heading to attribute |